<!-- $Id: sale_stats.htm 16420 2014-09-11 08:46:42 王海龙 $ -->
{include file="pageheader.htm"}
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{$__PUC__}js/jquery.js"></script>

<div class="form-div">
  <form action="" method="post" id="selectForm" name="selectForm">
    开始日期
    <input name="start_date" value="{$start_date}" style="width:150px;" onclick="return showCalendar(this, '%Y-%m-%d %H:%M', '24', false, this);" />
    结束日期
    <input name="end_date" value="{$end_date}" style="width:150px;" onclick="return showCalendar(this, '%Y-%m-%d %H:%M', '24', false, this);" />　
    <input type="submit" name="submit" value="提交" class="button" />
  </form>
</div>
<div class="tab-div">
    <div id="tabbar-div">
        <p>
            <span class="tab-front" id="number_stock-tab">进货预警</span>
            <span class="tab-back" id="pcs-tab">正在进货商品</span>
            <span class="tab-back" id="zero_number-tab">滞销商品</span>
        </p>
    </div>
    <div id="tabbody-div">
        <form action="" method="post" id="selectForm" name="selectForm">
        <table width="90%" cellspacing="0" cellpadding="3" border="1" id="number_stock-table" class="stable">
            <tr>
                <th>商品SKU</th>
                <th>商品名称</th>
                <th>属性</th>
                <th>进货价</th>
                <th>销量</th>
                <th>日平均销售量</th>
                <th>库存</th>
                <th>厂家</th>
                <th>物流时间</th>
                <th>建议采购量</th>
            </tr>
            {foreach from=$data key=k item=value}
                <tr><th><input type="checkbox" name="selected[]" value="{$value.0.B}">{$value.0.B}</th></tr>
                {foreach from=$value key=key item=item}
                <tr>
                    <td><input type="checkbox" name="sku[]" value="{$item.sku}" b-name="{$item.B}">{$item.sku}</td>
                    <td><input type="hidden" name="name[]" value="{$item.goods_name}{if $item.goods_attr}【{$item.goods_attr}】{/if}">{$item.goods_name}</td>
                    <td>{$item.goods_attr}</td>
                    <td>{$item.goods_xprice}</td>
                    <td>{$item.sales}</td>
                    <td>{$item.ST}</td>
                    <td>{$item.S}</td>
                    <td>{$item.B}</td>
                    <td>{$item.Q}</td>
                    <td>{$item.Z}</td>
                </tr>
                {/foreach}
            {/foreach}
            <tr>
                <td>
                    <input type="submit" value="批量进货">
                    <input type="hidden" name="act" value="pcs">
                </td>
            </tr>
        </table>
        </form>
        <form action="" method="post" id="selectForm" name="selectForm">
        <table width="90%" cellspacing="0" cellpadding="3" border="1" id="pcs-table" class="stable" style="display: none;">
            <tr>
                <th>商品SKU</th>
                <th>商品名称</th>
                <th>进货时间</th>
            </tr>
            {foreach from=$purchases key=k item=value}
                <tr><th><input type="checkbox" name="selected[]" value="{$value.0.add_time}">{$value.0.add_time}</th></tr>
                {foreach from=$value key=key item=item}
                <tr>
                    <td><input type="checkbox" name="id[]" b-name="{$item.add_time}" value="{$item.id}">{$item.sku}</td>
                    <td>{$item.name}</td>
                    <td>{$item.add_time}</td>
                </tr>
                {/foreach}
            {/foreach}
            <tr>
                <td>
                    <input type="submit" value="确认到货">
                    <input type="hidden" name="act" value="ischeck">
                </td>
            </tr>
        </table>
        </form>
        <table width="90%" cellspacing="0" cellpadding="3" border="1" id="zero_number-table" class="stable" style="display: none;">
            <tr>
                <th>商品SKU</th>
                <th>商品名称</th>
                <th>属性</th>
                <th>进货价</th>
                <th>库存</th>
            </tr>
            {foreach from=$data2 key=key item=item}
            <tr>
                <td>{$item.sku}</td>
                <td>{$item.goods_name}</td>
                <td>{$item.goods_attr}</td>
                <td>{$item.goods_xprice}</td>
                <td>{$item.stock}</td>
            </tr>
            {/foreach}
        </table>
    </div>
</div>
<script type="text/javascript">
    $("#tabbar-div span").click(function(){
        $(this).attr('class', 'tab-front').siblings().attr('class', 'tab-back');
        var id = $(this).attr('id')+'le';
        $("#tabbody-div table").hide();
        $("#"+id).show();
    });
    $("input[name='selected[]']").click(function(){
        var bname = $(this).val();
        if ($("input[b-name='"+bname+"']:checked").length == $("input[b-name='"+bname+"']").length) {
            $(this).prop('checked', false);
            $("input[b-name='"+bname+"']").prop('checked', false);
        } else {
            $(this).prop('checked', true);
            $("input[b-name='"+bname+"']").prop('checked', true);
        }
    })

</script>
{include file="pagefooter.htm"}